3.174 \(\int (a+b \sec ^2(e+f x))^2 \, dx\)

Optimal. Leaf size=40 \[ a^2 x+\frac{b (2 a+b) \tan (e+f x)}{f}+\frac{b^2 \tan ^3(e+f x)}{3 f} \]

[Out]

a^2*x + (b*(2*a + b)*Tan[e + f*x])/f + (b^2*Tan[e + f*x]^3)/(3*f)

________________________________________________________________________________________

Rubi [A]  time = 0.0294881, antiderivative size = 40, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 14, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.214, Rules used = {4128, 390, 203} \[ a^2 x+\frac{b (2 a+b) \tan (e+f x)}{f}+\frac{b^2 \tan ^3(e+f x)}{3 f} \]

Antiderivative was successfully verified.

[In]

Int[(a + b*Sec[e + f*x]^2)^2,x]

[Out]

a^2*x + (b*(2*a + b)*Tan[e + f*x])/f + (b^2*Tan[e + f*x]^3)/(3*f)

Rule 4128

Int[((a_) + (b_.)*sec[(e_.) + (f_.)*(x_)]^2)^(p_), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist
[ff/f, Subst[Int[(a + b + b*ff^2*x^2)^p/(1 + ff^2*x^2), x], x, Tan[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f, p},
 x] && NeQ[a + b, 0] && NeQ[p, -1]

Rule 390

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^(q_), x_Symbol] :> Int[PolynomialDivide[(a + b*x^n)
^p, (c + d*x^n)^(-q), x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && IGtQ[n, 0] && IGtQ[p, 0] && ILt
Q[q, 0] && GeQ[p, -q]

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rubi steps

\begin{align*} \int \left (a+b \sec ^2(e+f x)\right )^2 \, dx &=\frac{\operatorname{Subst}\left (\int \frac{\left (a+b+b x^2\right )^2}{1+x^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac{\operatorname{Subst}\left (\int \left (b (2 a+b)+b^2 x^2+\frac{a^2}{1+x^2}\right ) \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac{b (2 a+b) \tan (e+f x)}{f}+\frac{b^2 \tan ^3(e+f x)}{3 f}+\frac{a^2 \operatorname{Subst}\left (\int \frac{1}{1+x^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=a^2 x+\frac{b (2 a+b) \tan (e+f x)}{f}+\frac{b^2 \tan ^3(e+f x)}{3 f}\\ \end{align*}

Mathematica [B]  time = 0.397328, size = 106, normalized size = 2.65 \[ \frac{4 \sec ^3(e+f x) \left (a \cos ^2(e+f x)+b\right )^2 \left (3 a^2 f x \cos ^3(e+f x)+2 b (3 a+b) \sec (e) \sin (f x) \cos ^2(e+f x)+b^2 \tan (e) \cos (e+f x)+b^2 \sec (e) \sin (f x)\right )}{3 f (a \cos (2 (e+f x))+a+2 b)^2} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + b*Sec[e + f*x]^2)^2,x]

[Out]

(4*(b + a*Cos[e + f*x]^2)^2*Sec[e + f*x]^3*(3*a^2*f*x*Cos[e + f*x]^3 + b^2*Sec[e]*Sin[f*x] + 2*b*(3*a + b)*Cos
[e + f*x]^2*Sec[e]*Sin[f*x] + b^2*Cos[e + f*x]*Tan[e]))/(3*f*(a + 2*b + a*Cos[2*(e + f*x)])^2)

________________________________________________________________________________________

Maple [A]  time = 0.038, size = 48, normalized size = 1.2 \begin{align*}{\frac{1}{f} \left ({a}^{2} \left ( fx+e \right ) +2\,ab\tan \left ( fx+e \right ) -{b}^{2} \left ( -{\frac{2}{3}}-{\frac{ \left ( \sec \left ( fx+e \right ) \right ) ^{2}}{3}} \right ) \tan \left ( fx+e \right ) \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*sec(f*x+e)^2)^2,x)

[Out]

1/f*(a^2*(f*x+e)+2*a*b*tan(f*x+e)-b^2*(-2/3-1/3*sec(f*x+e)^2)*tan(f*x+e))

________________________________________________________________________________________

Maxima [A]  time = 1.01899, size = 59, normalized size = 1.48 \begin{align*} a^{2} x + \frac{{\left (\tan \left (f x + e\right )^{3} + 3 \, \tan \left (f x + e\right )\right )} b^{2}}{3 \, f} + \frac{2 \, a b \tan \left (f x + e\right )}{f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sec(f*x+e)^2)^2,x, algorithm="maxima")

[Out]

a^2*x + 1/3*(tan(f*x + e)^3 + 3*tan(f*x + e))*b^2/f + 2*a*b*tan(f*x + e)/f

________________________________________________________________________________________

Fricas [A]  time = 0.482485, size = 142, normalized size = 3.55 \begin{align*} \frac{3 \, a^{2} f x \cos \left (f x + e\right )^{3} +{\left (2 \,{\left (3 \, a b + b^{2}\right )} \cos \left (f x + e\right )^{2} + b^{2}\right )} \sin \left (f x + e\right )}{3 \, f \cos \left (f x + e\right )^{3}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sec(f*x+e)^2)^2,x, algorithm="fricas")

[Out]

1/3*(3*a^2*f*x*cos(f*x + e)^3 + (2*(3*a*b + b^2)*cos(f*x + e)^2 + b^2)*sin(f*x + e))/(f*cos(f*x + e)^3)

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \left (a + b \sec ^{2}{\left (e + f x \right )}\right )^{2}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sec(f*x+e)**2)**2,x)

[Out]

Integral((a + b*sec(e + f*x)**2)**2, x)

________________________________________________________________________________________

Giac [A]  time = 1.32292, size = 72, normalized size = 1.8 \begin{align*} \frac{b^{2} \tan \left (f x + e\right )^{3} + 3 \,{\left (f x + e\right )} a^{2} + 6 \, a b \tan \left (f x + e\right ) + 3 \, b^{2} \tan \left (f x + e\right )}{3 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sec(f*x+e)^2)^2,x, algorithm="giac")

[Out]

1/3*(b^2*tan(f*x + e)^3 + 3*(f*x + e)*a^2 + 6*a*b*tan(f*x + e) + 3*b^2*tan(f*x + e))/f